<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="msg :: common_header(_,~{::link})">

    <title>Awesome - Main</title>

    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/themes/smoothness/jquery-ui.css}">
    <!-- javascript内联-->
    <script type="text/javascript" th:inline="javascript">

    </script>
</head>
<script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript">
    function bbb(data) {
        var result = JSON.stringify(data);
        alert("回调函数" + result)
    }


    function sub() {

        $.ajax({
            url: "http://localhost:8080/mvc/test",
            type: "GET",
            // 指定服务器返回的数据类型
            dataType: "jsonp",
            jsonpCallback: "bbb",
            jsonp: "callback",
            success: function (data) {
                alert(data.name)
                var result = JSON.stringify(data);
                alert(result)
            }
        });

        $.ajax({
            url: 'http://localhost:9111/v1/test',
            type: 'GET',
            success: function (data) {
                $(text).val(data);
            }
        });
    }
</script>
<body>

<button onclick="sub() " type="button">测试跨域</button>


<h1>Hello</h1>
<h1 th:text="${name}"></h1>
<div th:insert="frag/footer.html::copy"></div>
<div th:insert="~{frag/footer.html::copy}"></div>
<div th:insert="~{frag/footer.html::#copy-section}"></div>


<div><span th:with="a1=123,a2='哈哈'"> <span th:text="${a1}"></span></span>局部变量</div>
</div>


<div th:fragment="frag (onevar,twovar)">
    <p th:text="${onevar} + ' - ' + ${twovar}">...</p>
</div>

<div th:replace="::frag (1,2)">...</div>


<div th:fragment="common_div(title,links)">
    <p th:text="${title}"></p>
    <p th:text="${links}"></p>
</div>

<div th:replace="::common_div(22222,~{::link})"></div>

</div>


<div th:remove="all"><span>删除模板,包含标签及其所有子项</span></div>
<div th:remove="body">删除模板<span>不删除包含标签，但删除所有的子项</span></div>
<div th:remove="tag">删除模板<span>但不要删除其子项</span></div>
<div th:remove="all-but-first">删除模板<span>:删除第一个子项以外的其它所有子项<a>第二包含</a></span></div>
<div th:remove="none">删除模板<span>但不要删除其子项<a>第二包含</a></span></div>


<p th:with="df=#{date.format}">
    Today is: <span th:text="${#calendars.format(today,df)}">13 February 2011</span>
</p>

<!--内联表达式-->
<div th:inline="none"> [[${msg}]]</div>
<div> [(${msg})]</div>


<!--文本内联-->
<div th:inline="text"> [[${msg}]]</div>

<!--内置对象-->
<div>#execInfo：模板名称:<span th:text="${#execInfo.templateName}"></span></div>
<div>#execInfo：模板处理方式:<span th:text="${#execInfo.templateMode}"></span></div>
<div>#messages:<span th:text="${#messages.msg(name)}"></span></div>


<div>#messages:<span th:text="${#messages.msg(name)}"></span></div>

<div>#uris转义:<span th:text="${#uris.escapePath('https://www.baidu.com')}"></span></div>
</body>
</html>